﻿<%@ Page Title="" Language="C#" MasterPageFile="~/XB/MasterPage/CommonXB.master"
    AutoEventWireup="true" CodeFile="RegistrationXB.aspx.cs" Inherits="BM_Course_RegistrationXB" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2" runat="Server">

    <style>
        .red, .error
        {
            color: #ff0000;
        }
        .frmReg .lblFormItem
        {
            display: inline-block;
            width: 100px;
            text-align: right;
        }
        .frmReg .inputFormItem
        {
            border: solid 1px #a3b7e3;
        }
        .frmReg .large
        {
            width: 300px;
        }
        .frmReg .middle
        {
            width: 100px;
        }
        .frmReg .small
        {
            width: 50px;
        }
        .frmReg .row
        {
            margin-top: 20px;
            margin-bottom: 10px;
        }
        .hidden
        {
        	display: none;
        }
    </style>

    <script type="text/javascript">
        $(function() {
            setMenu(2);
        });
    </script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div class="sidenav">
        首页&nbsp;>&nbsp;课程中心&nbsp;>&nbsp;<strong>课程明细</strong>
    </div>
    <div class="clearfix">
        <div class="courseinfo_L l">
            <div id="tabs" style="border: none;">
                <ul style="background: none; border: none;">
                    <li><a href="#tabs-1">活动报名</a></li>
                </ul>
                <div id="tabs-1" style="border: 1px solid #aaaaaa; border-radius: 4px;">
                    <div class="clearfix">
                        <div class="title_new">
                            <span>活动名称：</span>
                            <asp:Literal ID="ltlTitle" runat="server">测试活动1</asp:Literal>
                        </div>
                        <table class="frmReg" cellspacing="1">
                            <tr>
                                <td>
                                    <div class="row">
                                        <label class="lblFormItem">
                                            姓名：</label>
                                        <input type="text" id="txtRealName" name="txtRealName" runat="server" class="inputFormItem middle" />
                                        <span class="red">*</span>
                                        <span id="spRealName"  class="error hidden">姓名不能为空</span>
                                    </div>
                                    <div class="row">
                                        <label class="lblFormItem">
                                            性别：</label>
                                        <input type="radio" id="radioMale" name="gender" style="vertical-align: middle;"
                                            runat="server" value="1" /><span>男</span>
                                        <input type="radio" id="radioFemale" name="gender" style="vertical-align: middle;"
                                            runat="server" value="0" /><span>女</span> <span class="red">*</span>
                                        <span id="spSex"  class="error hidden">性别不能为空</span>
                                    </div>
                                    <div class="row">
                                        <label class="lblFormItem">
                                            年龄：</label>
                                        <input type="text" id="txtAge" runat="server" class="inputFormItem small" />
                                        <span class="red">*</span>
                                        <span id="spAge"  class="error hidden">年龄不能为空</span>
                                    </div>
                                    <div class="row">
                                        <label class="lblFormItem">
                                            家庭地址：</label>
                                        <input type="text" id="txtHomeAddress" runat="server" class="inputFormItem large" />
                                        <span class="red">*</span>
                                        <span id="spHomeAddress"  class="error hidden">家庭住址不能为空</span>
                                    </div>
                                    <div class="row">
                                        <label class="lblFormItem">
                                            联络地址：</label>
                                        <input type="text" id="txtContactAddress" runat="server" class="inputFormItem large" />
                                        <span class="red">*</span>
                                        <span id="spContactAddress"  class="error hidden">联络地址不能为空</span>
                                    </div>
                                    <div class="row">
                                        <label class="lblFormItem">
                                            手机号码：</label>
                                        <input type="text" id="txtMobile" runat="server" class="inputFormItem middle" />
                                        <span class="red">*</span>
                                        <span id="spMobile"  class="error hidden">手机号码不能为空</span>
                                    </div>
                                    <div class="row">
                                        <label class="lblFormItem">
                                            养游时间：</label>
                                        <input type="text" id="txtBeginDate" runat="server" class="inputFormItem middle" readonly="readonly" maxlength="10" />
                                        <span>&nbsp;&nbsp;至&nbsp;&nbsp;</span>
                                        <input type="text" id="txtEndDate" runat="server" class="inputFormItem middle" />
                                        <span id="spDate"  class="error hidden">养游时间不能为空</span>
                                    </div>
                                    <div class="row">
                                        <label class="lblFormItem">
                                            服务要求：</label>
                                        <input type="text" id="txtRequirement" runat="server" class="inputFormItem large" />
                                    </div>
                                    <div class="row">
                                        <label class="lblFormItem">
                                            随行人数：</label>
                                        <input type="text" id="txtCount" runat="server" class="inputFormItem small" />
                                        <span class="red">*</span>
                                        <span id="spCount"  class="error hidden">随行人数不能为空</span>
                                    </div>
                                    <div class="row">
                                        <label class="lblFormItem">
                                            验证码：</label>
                                        <asp:TextBox ID="CheckCode" CssClass="inputFormItem" runat="server" Width="60px"
                                            MaxLength="20" AutoCompleteType="Disabled"></asp:TextBox>
                                        &nbsp;<img src="CheckCode.aspx" id="checkcode_img" name="checkcode" alt="请输入验证码!" />
                                        <a title="刷新验证码" href="#" onclick="javascript:document.getElementById('checkcode_img').src='CheckCode.aspx?id='+Math.random();return false;">
                                            看不清，换张图片？</a>
                                        <span id="spCode"  class="error hidden">验证码不能为空</span>
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td style="padding-left: 100px; padding-bottom: 50px;">
                                    <input id="btnCheck" type="button" class="commonBtn_Lsave" style="font-size: 14px; text-align: center; height: 32px;line-height: 25px; cursor: pointer;" value="确定" />
                                    <asp:LinkButton ID="btnSave" runat="server" OnClick="btnSave_Click" Style="display: none" />
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
            </div>
        </div>
        <div class="courselist_R courselist  r">
            活动简介
        </div>
    </div>
    <div id="dv_warning" title="提示">
    </div>

    <script type="text/javascript">
        
        //设置选项卡
        $("#tabs").tabs();
        
        //验证数字
        function checkNumber(obj) {
            var reg = /^[0-9]+$/;
            if (obj != "" && !reg.test(obj)) {
                return false;
            }
            else {
                return true;
            }
        }

        //验证手机号
        function validateMobile(obj) {
            if (obj.length == 0) {
                return false;
            }
            if (obj.length != 11) {
                return false;
            }

            var myreg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
            if (!myreg.test(obj)) {
                return false;
            }

            return true;
        }

        $(document).ready(function() {
        
            $("#<%= txtBeginDate.ClientID %>").datepicker({
                showAnim: 'slideDown',
                changeMonth: true,
                changeYear: true,
                hideIfNoPrevNext: true,
                dateFormat: 'yy-mm-dd'
            });
            $("#<%= txtEndDate.ClientID %>").datepicker({
                showAnim: 'slideDown',
                changeMonth: true,
                changeYear: true,
                hideIfNoPrevNext: true,
                dateFormat: 'yy-mm-dd'
            });

            $("#btnCheck").click(function() {

                var errorCount = 0;

                var _realName;
                var _sex;
                var _age;
                var _homeAddress;
                var _contactAddress;
                var _mobile;
                var _beginDate;
                var _endDate;
                var _requirement;
                var _count;
                var _code;

                _realName = $.trim(jQuery("#<%= txtRealName.ClientID %>").val());
                _age = $.trim(jQuery("#<%= txtAge.ClientID %>").val());
                _sex = $.trim($("input:radio[name='ctl00$ContentPlaceHolder1$gender'][checked]").val());
                _homeAddress = $.trim(jQuery("#<%= txtHomeAddress.ClientID %>").val());
                _contactAddress = $.trim(jQuery("#<%= txtContactAddress.ClientID %>").val());
                _mobile = $.trim(jQuery("#<%= txtMobile.ClientID %>").val());
                _beginDate = $.trim(jQuery("#<%= txtBeginDate.ClientID %>").val());
                _endDate = $.trim(jQuery("#<%= txtEndDate.ClientID %>").val());
                _requirement = $.trim(jQuery("#<%= txtRequirement.ClientID %>").val());
                _count = $.trim(jQuery("#<%= txtCount.ClientID %>").val());
                _code = $.trim($("#<%= CheckCode.ClientID %>").val());

                if (_realName == "") { $("#spRealName").show(); errorCount++; } else { $("#spRealName").hide(); }
                if (_age == "") { $("#spAge").show(); errorCount++; } else { $("#spAge").hide(); }
                if (_sex == "") { $("#spSex").show(); errorCount++; } else { $("#spSex").hide(); }
                if (_homeAddress == "") { $("#spHomeAddress").show(); errorCount++; } else { $("#spHomeAddress").hide(); }
                if (_contactAddress == "") { $("#spContactAddress").show(); errorCount++; } else { $("#spContactAddress").hide(); }
                if (_mobile == "") { $("#spMobile").show(); errorCount++; } else { $("#spMobile").hide(); }
                if (_beginDate == "" || _endDate == "") { $("#spDate").show(); errorCount++; } else { $("#spDate").hide(); }
                if (_count == "") { $("#spCount").show(); errorCount++; } else { $("#spCount").hide(); }
                if (_code == "") { $("#spCode").show(); errorCount++; } else { $("#spCode").hide(); }

                if (!checkNumber(_age)) { $("#spAge").html("只能填写数字").show(); errorCount++; } else { $("#spAge").hide(); }
                if (!checkNumber(_count)) { $("#spAge").html("只能填写数字").show(); errorCount++; } else { $("#spCount").hide(); }
                if (!validateMobile(_mobile)) { $("#spMobile").html("输入的手机号无效").show(); errorCount++; } else { $("#spMobile").hide(); }

                if (errorCount == 0) {
                    __doPostBack('ctl00$ContentPlaceHolder1$btnSave', '');
                }
            });
        });

</script>

</asp:Content>
